const { Op } = require('sequelize')
const { User } = require('./user')

class Art {
  static async userInfoList(infoList) {
    const userInfoList = await User.scope('bh').findAll({
      where: {
        id: {
          [Op.in]: infoList
        }
      }
    })
    const userInfoObj = {}
    for(let info of userInfoList) {
      userInfoObj[info.id] = info
    }
    return userInfoObj
  }

  static async userInfo(id) {
    const user = await User.scope('bh').findOne({
      where: {
        id
      }
    })

    return user
  }
}

module.exports = {
  Art
}